<?php
/**
 * @version		$Id: default.php 2011.08.11 thierry $
 * @package		admin.views.links.tmpl
 * @subpackage	com_projid
 * @copyright	Copyright (C) 2011 Pojid All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */
// No direct access to this file
defined('_JEXEC') or die('Restricted Access');
// load tooltip behavior
JHtml::_('behavior.tooltip');
JHtml::_('behavior.multiselect');

$user		= JFactory::getUser();
$app		= JFactory::getApplication();
$userId		= $user->get('id');
$listOrder	= $this->escape($this->state->get('list.ordering'));
$listDirn	= $this->escape($this->state->get('list.direction'));
//$ordering 	= ($listOrder == 'a.lft');
//$canOrder	= $user->authorise('core.edit.state',	'com_menus');
//$saveOrder 	= ($listOrder == 'a.lft' && $listDirn == 'asc');
 

?>
<form action="<?php echo JRoute::_('index.php?option=com_projid&view=links'); ?>"method="post" name="adminForm">
	<fieldset id="filter-bar">
		<div class="filter-select">
	
			<label>Visualiser les paramètres pour le report : </label>
			<select name="birt_name" class="inputbox" onchange="this.form.submit()">
				<?php 
					echo JHtml::_('select.options', $this->birt_list, 'value', 'text', $this->state->get('filter.birt_name'));
				?>
			</select>

		</div>
	</fieldset>
	<div class="clr"> </div>
	<p><?PHP
	?></p>
	<table class="adminlist">
		<thead>
			<tr>
				<th width="5">
					<?php echo JText::_('COM_PROJID_LINK_REPORT_HEADING_ID'); ?>
				</th>
				<th width="5">
					<?php echo JText::_('COM_PROJID_LINK_PARAM_HEADING_ID'); ?>
				</th>
				<th width="20">
					<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($this->items); ?>);" />
				</th>			
				<th>
					<?php echo JText::_('COM_PROJID_LINK_HEADING_NAME'); ?>
				</th>
				<th>
					<?php echo JText::_('Ordre des paramètres');?>
					<?php echo JHtml::_('grid.order',  $this->items, 'filesave.png', 'links.saveorder'); ?>
				</th>
				
				<th>
					<?php echo JText::_('COM_PROJID_LINK_HEADING_PARAMETERS'); ?>
				</th>
			</tr>
		</thead>
		<tbody>
		<?php foreach($this->items as $i => $item):
			$orderkey = array_search($item->link_id, $this->ordering[$item->report_id]);
			$canCreate	= $user->authorise('core.create',		'com_menus');
			$canEdit	= $user->authorise('core.edit',			'com_menus');
			$canCheckin	= $user->authorise('core.manage',		'com_checkin') || $item->checked_out==$user->get('id')|| $item->checked_out==0;
			$canChange	= $user->authorise('core.edit.state',	'com_menus') && $canCheckin;
			?>
			<tr class="row<?php echo $i % 2; ?>">
				<td>
					<?php echo $item->report_id; ?>
				</td>
				<td>
					<?php echo $item->param_id; ?>
				</td>
				<td>
					<?php 
						echo JHtml::_('grid.id', $i,$item->link_id); ?>
				</td>
				<td>
					<?php echo $this->escape($item->birt_name); ?>
					
				</td>
						<td class="order">
								<input type="text" name="order[]" size="5" value="<?php echo $orderkey + 1;?>" class="text-area-order" />
								<?php $originalOrders[] = $orderkey + 1; ?>
						</td>
				<td>
					<a href="<?php echo JRoute::_('index.php?option=com_projid&task=link.edit&link_id='.$item->link_id);?>">
					<?php echo $item->param_name  ?>
					</a>
				</td>
			</tr>
		<?php endforeach; ?>
		<tr>
			<td colspan="3"><?php echo $this->pagination->getListFooter(); ?></td>
		</tr>
		
		</tbody>
	</table>
	<div>
		
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="boxchecked" value="0" />
		<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
		<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
		<input type="hidden" name="original_order_values" value="<?php echo implode($originalOrders, ','); ?>" />
		<?php echo JHtml::_('form.token'); ?>
	</div>
</form>
